<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input class="input" type="text" name="pwd">
    <button type="submit">submit</button>
    <button onclick="show()">click</button>
    <script>
        var input = document.querySelector('.input');
        function show() {
            var e = event || window.event;
            console.log(e);
        }
        input.onkeyup = function() {
            var e = event || window.event;
            console.log(e.keyCode);
        }
    </script>
</body>

</html>